using System;

namespace Domain.Model
{
    public static class TransfomUrl
    {
        public static string Transfom(string longUrl)
        {
           var transfomUrl = new char[8];
            if (longUrl != null)
                    if (longUrl.Length > 0)
                    {
                        var rnd = new Random(longUrl.GetHashCode());
                        for (int i = 0; i < 8; i++)
                        {
                            while (transfomUrl[i] == '\0')
                            {
                                int r = rnd.Next(47, 123);
                                if (r < 58 || r > 64 && r < 91 || r > 96)
                                    transfomUrl[i] = (char)r;
                            }
                        }
                        return new string(transfomUrl);
                    }
                    else return null;
                else return null;
        }
    }
}